#!/bin/bash

if [ ! -d /home/$1/.ssh ]
then
   mkdir /home/$1/.ssh
fi
chmod 755 /home/$1/.ssh
g="hmc"
chown root.$g /home/$1/.ssh
if [ ! -f /home/"$1"/.ssh/authorized_keys2 ]
then
  touch /home/"$1"/.ssh/authorized_keys2
  chown "$1"."$g" /home/"$1"/.ssh/authorized_keys2
  chmod 644 /home/"$1"/.ssh/authorized_keys2
fi

/bin/cp /etc/ssh/sshrc /home/$1/.ssh/rc
chown root.root /home/$1/.ssh/rc
chmod 644 /home/$1/.ssh/rc
cp /opt/hsc/data/ssh/hmcsshrc /home/$1/.mysshrc
chmod 555 /home/$1/.mysshrc
chown root.root /home/$1/.mysshrc
cp /opt/hsc/data/ssh/bashrc /home/$1/.bashrc
chmod 555 /home/$1/.bashrc
chown root.root /home/$1/.bashrc
cp /opt/hsc/data/ssh/hmcprofile /home/$1/.bash_profile
chmod 555 /home/$1/.bash_profile
chown root.root /home/$1/.bash_profile

exit 0
